<template>
	<view class="science-detail">
		<!-- 文章内容区域 -->
		<view class="content" v-if="articleData.isOutLink!=='1'">
			<view class="article-title">{{articleData.title}}</view>
			<view class="article-info">
				<text class="source">来源：{{articleData.author}}</text>
			</view>
			<view class="article-info">
				<text class="date">{{articleData.newDate}}</text>
			</view>

			
			<u-parse :content="articleData.info"></u-parse>
		</view>
		<view class="content" v-if="articleData.isOutLink==='1'">
			<web-view :src="articleData.linkUrl"></web-view>
		</view>
	</view>
</template>

<script>
	import {
		pointsRule
	} from '@/api/points.js'
	export default {
		data() {
			return {
				articleData: {
				},
				userId: this.$store.state.user.userId
			}
		},
		onLoad(option) {
			this.articleData = JSON.parse(decodeURIComponent(option.article))
			// 积分任务奖励
			this.pointsRule()
		},
		methods: {
			navigateBack() {
				uni.navigateBack()
			},
			pointsRule() {
			pointsRule({
				taskId:'16',
				userId: this.userId
			}).then(res => {
				console.log(res)
			})
		}
		}
	}
</script>

<style>
	.science-detail {
		min-height: 100vh;
		background: #fff;
		padding-left: 20rpx;
		padding-right: 20rpx;
	}

	.header {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		height: 88rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0 30rpx;
		background: #fff;
		z-index: 99;
	}

	.back,
	.more {
		width: 60rpx;
		height: 60rpx;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.iconfont {
		font-size: 40rpx;
		color: #333;
	}

	.title {
		font-size: 34rpx;
		font-weight: 500;
		color: #333;
	}

	.content {
		padding: 60rpx 30rpx 30rpx;
	}

	.article-title {
		font-size: 40rpx;
		font-weight: bold;
		color: #333;
		line-height: 1.4;
		margin-bottom: 20rpx;
	}

	.article-info {
		display: flex;
		align-items: center;
		margin-bottom: 30rpx;
		font-size: 26rpx;
		color: #999;
	}

	.source {
		margin-right: 20rpx;
	}

	.rich-content {
		font-size: 30rpx;
		line-height: 1.8;
		color: #333;
	}

	.content-item {
		margin-bottom: 20rpx;
	}

	.article-subtitle {
		font-size: 34rpx;
		font-weight: 500;
		color: #333;
		margin: 30rpx 0;
	}

	.section-title {
		font-size: 32rpx;
		font-weight: 500;
		color: #333;
		margin: 30rpx 0 20rpx;
	}

	.suggestion {
		background: #f8f8f8;
		padding: 20rpx;
		border-radius: 8rpx;
		margin: 20rpx 0;
	}
</style>